package com.cyq.day17.Demo7;

import java.util.Arrays;

public class Computer {
    USB[] usb=new USB[3];

    @Override
    public String toString() {
        return "Computer{" +
                "usb=" + Arrays.toString(usb) +
                '}';
    }

    public void add(){
        usb[0]=new Mouse();
        usb[1]=new KeyBoard();
        usb[2]=new Mic();
        for (int i = 0; i <usb.length ; i++) {
            if ("".equals(usb[i].toString())){
                usb[i]=new Mic();
            }
        }
    }
}
